//
//  THJDataSellersCell.m
//  THJXHW
//
//  Created by 河南德艺 on 2017/11/1.
//  Copyright © 2017年 河南德艺. All rights reserved.
//

#import "THJDataSellersCell.h"
#import <UIImageView+WebCache.h>
@implementation THJDataSellersCell
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    for(id obj in self.contentView.subviews){
        if([obj isKindOfClass:[UILabel class]]){
            NSLog(@"UILabel");
        }else if([obj isKindOfClass:[UIButton class]]){
            NSLog(@"UIbutton");
        }else if([obj isKindOfClass:[UIImageView class]]){
            NSLog(@"UIIMageview");
        }else{
            UIView * view = (UIView*)obj;
            view.layer.borderWidth = 0.5;
            view.layer.borderColor = COLOR(203, 204, 205, 1).CGColor;
            NSLog(@"UIView");
        }
    }
}
-(void)sellerTap:(UITapGestureRecognizer*)tap{
    NSLog(@"%ld",tap.view.tag);
    [self.delegate companClickIndex:tap.view.tag];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)setContentWithArr:(NSMutableArray*)arr{
    NSLog(@"seller-%@",arr);
    NSArray * labArr = @[self.lab1,self.lab2,self.lab3,self.lab4,self.lab5,self.lab6];
    NSArray * logoArr = @[self.LogoImg,self.logoImg2,self.logoImg3,self.logoImg4,self.logoImg5,self.logoImg6];
    NSArray * pImgArr = @[self.pImg1,self.pimg2,self.pImg3,self.pImg4,self.pImg5,self.pImg6];
    for(NSInteger i = 0;i<arr.count;i++){
        NSDictionary * dic = arr[i];
        UILabel * lab = labArr[i];
        UIView * labSuperView = lab.superview;
        UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sellerTap:)];
        [labSuperView addGestureRecognizer:tap];
        UIImageView * logoImg = logoArr[i];
        UIImageView * pImg = pImgArr[i];
        [logoImg sd_setImageWithURL:[NSURL URLWithString:dic[@"logo"]] placeholderImage:nil];
        [pImg sd_setImageWithURL:[NSURL URLWithString:dic[@"cat_logo"]] placeholderImage:nil];
        lab.text = dic[@"cat_name"];
    }
}
- (IBAction)getMoreCompany:(id)sender {
    [self.delegate getMoreCompany];
}
@end
